<?php
namespace iBrand\EC\Open\Server\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Libs\wechatCallbackapi;
use App\Libs\wechatCallbackapiTest;


class WeixinController extends Controller
{



    public function index()
    {
        date_default_timezone_set('Asia/Shanghai');
        $wechatObj = new wechatCallbackapiTest();
        if (!isset($_GET['echostr']))
        {
            $res = $wechatObj->responseMsg();
        }else
        {
            $res = $wechatObj->valid();
        }
        echo $res;die;
    }
    public function supplygoods()
    {
        date_default_timezone_set('Asia/Shanghai');
        Storage::disk('test')->append('supplygoods.log',date('Y-m-d H:i:s').'返回明文:bbb');
        $wechatObj = new wechatCallbackapi();
        if (!isset($_GET['echostr']))
        {
            $res = $wechatObj->responseMsg();
        }else
        {
            $res = $wechatObj->valid();
        }
        echo $res;die;
    }
    /*
     * 零米微生活菜单栏
     * */
    public function createMenu()
    {
//        $url1 = 'http://'.$_SERVER['SERVER_NAME'].'/supply/login';
//        $url2 = 'http://'.$_SERVER['SERVER_NAME'].'/supply/client';
        $url1 = env('H5_URL','https://m.dev.osv.cn').'/supply/login';
        $url2 = env('H5_URL','https://m.dev.osv.cn').'/supply/client';
        $jsmenu = '{
                    "button": [
                                {"name": "零食铺", "type":"view","url":"https://h5.youzan.com/wscshop/home/bm1fdqu8?alias=bm1fdqu8&redirect_count=1"},
                                {"name": "会员生活","type":"view","url":"https://h5.acewill.net/"},
                            ]
                    }';
        $wechatObj = new wechatCallbackapi();
        $a = $wechatObj->createmenu($jsmenu);
        var_dump($a);exit;
    }


    public function getMenu(){
        $wechatObj = new wechatCallbackapiTest();
        $a = $wechatObj->getToken();
        var_dump($a);
    }


    public function createqrcode(){
        $wechatObj = new wechatCallbackapiTest();
        $res = $wechatObj->createqrcode();
        var_dump($res);
    }




}
